-
Notifications
You must be signed in to change notification settings - Fork 530
Improve documentation of struct expressions #1799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
335767e
to
119164c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I opened #1802 to capture my thoughts on this in general, and to consider just removing all of this. (Not a blocker for this PR.) I've never been particularly comfortable with how this is presented.
src/expressions/struct-expr.md
Outdated
StructExprTuple -> | ||
PathInExpression `(` | ||
PathExpression `(` | ||
( Expression (`,` Expression)* `,`? )? | ||
`)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to simplify this further it can be StructExprTuple -> CallExpression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
+ simplify/clarify the grammar
119164c
to
f025b98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This compiles:
So qualified paths can be used when constructing tuple/unit variants. This PR documents that. (note that tuple/unit struct expressions aren't really a thing -- they are just calls/paths, so this doesn't necessarily change much, calls/paths already have correct docs)
Additionally I added more mentions of the fact that these expressions are the same for enums.